import { ResolveOptions, AliasOptions } from 'vite'
import * as path from 'path'

const root = path.resolve(__dirname, '../../')

/**
 * 为 Vite 配置解析
 *
 * @returns {ResolveOptions & {alias: AliasOptions}} Vite 解析配置
 */
export const useResolve = (): ResolveOptions & { alias: AliasOptions } => {
  return {
    alias: {
      '~': root,
      '@': path.resolve(root, './src'),
    },
  }
}
